<?php
include "../../../lib/list.php";
if($_GET['s_no']){
	$s_no = $_GET['s_no'];
	$sear_char = " AND s_no = $s_no";
}else{
	$sear_char = " AND s_no = '0'";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
<head>
<link rel="stylesheet" href="../../../css/list.css" type="text/css"></link>
<link rel="stylesheet" href="../../../css/table.blue.sorter.css" type="text/css" media="print, projection, screen"></link>

<script type="text/javascript" src="../../../js/jquery-1.2.6.js"></script>
<script type="text/javascript" src="../../../js/list.js"></script>
<script type="text/javascript">


</script>
</head>
<body style="padding:0; margin:0;">
	<form name="view" method="post" action="frame.php" id="view">
	<input type="hidden" value="insert" name="mode"/>
	<input type="hidden" value="<?=$s_no?>" name="s_no"/>
	<table cellspacing="1" class="tablesorter" id="tablesorter" style="padding:0; margin:0;">
			<thead>
					<tr>
						<th width="10px"><input
							onclick="if (this.checked) all_checked(true); else all_checked(false);"
							type=checkbox tabindex=1 name=chk_head />
						</th>
						<th width="30px">no</th>
						<th>barcode</th>
						<th>상품명</th>
						<th>로스수</th>
						<th>날짜</th>
					</tr>
					</thead>
					<tfoot>
					<tr>
						<th width="10px">&nbsp;
						</th>
						<th width="30px">no</th>
						<th>barcode</th>
						<th>상품명</th>
						<th>로스수</th>
						<th>날짜</th>
					</tr>
					</tfoot>
					<tbody>
					<?php	
						$query = "SELECT * FROM uatp_stocktmp WHERE 1 $sear_char order by date DESC";
						$total = DBnumrows($query);
						$result = DBquery($query);
						
						for($i=1; $list = mysql_fetch_array($result); $i++){
							$bunho = $total - ( $i + $cline) + 1;
							
							$product = DBarray("SELECT * FROM uatp_product WHERE no = ".$list['p_no']);
							
							$gap = $list['gap'];
							
							if($gap>0){
								$gap_view = "<font color='blue'>".$gap."&nbsp;".$list['unit']."</font>";
							}
							else if($gap<0){
								$gap_view = "<font color='#B4045F'>".$gap."&nbsp;".$list['unit']."</font>";
							}
							else{
								$gap_view = "정상";
							}
							
							?>
							<tr onclick="javascript:chk(<?=$list['no']?>)">
								<td><input type=checkbox name=chk_no[]
									value="<?=$list['no']?>" onclick="javascript:chk(<?=$list['no']?>)"></input></td>
								<td align="center" width="30px"><?=$bunho?></td>
								<td><?=$product['barcode']?></td>
								<td><?=$product['productname']?></td>
								<td><?=$gap_view?></td>
								<td><?=date('Y-m-d',strtotime($list['date']))?></td>
							</tr>
<?php 
}
	mysql_free_result($result);
?>
					</tbody>
		</table>
		</form>
</body>
</html>